|
|
|
|
|
|
|
form.) If the current control is a text box, I then set the Tag property of the text box to the value from the Recordset object, where the name of the field is equal to the name of the field in the DataField property of that text box. I perform the same type of assignment for the check boxes as well. |
|
|
|
|
|
|
|
|
Now that youve synchronized all the data in the value of the data-bound controls, you now need to look at how to toggle the command buttons at the appropriate time in response to a user typing in or moving to a new record. |
|
|
|
|
|
|
|
|
Lets add code to the Change event of the text box controls. This code will help you determine whether the user typed in data or just moved to a new record. In the Change event, you need to check to see whether the Tag property is equal to the Text property. If they are not equal, you know that the user just made a change to the text box. If theyre the same, you know that the user just moved from one record to another using the data control: |
|
|
|
 |
|
|
|
|
Private Sub txtFirst_Change()
If txtFirst.Tag <> txtFirst.Text Then
Call TextChanged
End If
End Sub
Private Sub txtLast_Change()
If txtLast.Tag <> txtLast.Text Then
Call TextChanged
End If
End Sub |
|
|
|
|
| Add Code to the Change Events 1. Add the preceding code to the Change event of each text box. |  | By adding this code to the Change events of each text box you can detect when the user makes changes to the data. |
|
|
|
|
|
|
The TextChanged( ) Procedure |
|
|
|
|
|
|
|
|
The TextChanged() procedure, shown in the Change events of the text boxes, performs a couple of checks for you. First, it checks to make sure the recordset is on a valid record. If it is on a valid record, the TextChanged() procedure then checks to |
|
|
|
|
|